<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>红包详情</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
		<style type="text/css">
			#sfz_pic{position: relative;}/*opacity: 0;*/
			 .upload,.upload1{position: absolute;top: 0;left: 0;width: 100%;height: 100%;opacity: 0;}
		</style>
	</head>

	<body>
		<form class="layui-form update_form">
			<div class="layui-form-item">
				<label class="layui-form-label">人数</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="user_num" value="{$data.user_num}" readonly="" required lay-verify="required" placeholder="人数" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">鼓励金总额</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="gold_sum" value="{$data.gold_sum}" readonly="" required lay-verify="required" placeholder="鼓励金总额" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">红包类型</label>
				<div class="layui-input-block update_shurk">
					<select name="type">
						{if condition="$data['type'] eq 1 " }
						<option value="1" >锁粉红包</option>
						{/if}
						{if condition="$data['type'] eq 3 " }
						<option value="3" >扫码红包</option>
						{/if}
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">领取规则</label>
				<div class="layui-input-block update_shurk">
					<select name="hb_type">
						{if condition="$data['hb_type'] eq 1 " }
						<option value="1">平均</option>
						{/if}
						{if condition="$data['hb_type'] eq 2 " }
						<option value="2">随机</option>
						{/if}
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="memo" id="memo" value="{$data.memo}" required placeholder="备注" autocomplete="off" class="layui-input" >
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">已领取人数</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="peoples" value="{$data.peoples}" readonly="" required lay-verify="required"  autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">已领取鼓励金</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="sums" value="{$data.sums}" readonly="" required lay-verify="required"  autocomplete="off" class="layui-input">
				</div>
			</div>
		</form>
	</body>
</html>
<script>
	layui.use('form', function() {
		var form = layui.form;
		//监听表单提交
		form.on('submit(submit_from)', function(data){
			tijiao();
  			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
	});
	
function tijiao() {
$.ajax({
	type: "post",
	url: "{:url('activet/gold_add')}",
	data: $('.layui-form').serialize(), //表单数据
	success: function(data) {
		if(data.code == 200) {
			layer.msg('操作成功', {
				icon: 1,
				time: 1500 //2秒关闭（如果不配置，默认是3秒）
			}, function() {
				window.parent.location.reload();
				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
				parent.layer.close(index);
			});
		} else {
			layer.msg('操作失败！'); //保存成功提示
			}
		},
		error: function(data) {
			var a = data;
		}
	});

}
</script>